
#老版本的，仅供参考
import winreg
import datetime
import shutil
import os
import time
import ctypes
import os.path
from configparser import ConfigParser
import subprocess
import threading
import concurrent.futures
import random
import requests
import json


V="3.6.6"
up="---更新记录---\n[1] 更新排版。 \n[2] 更新今日人品 \n[3] 修复一些BUG\n[4] 更新版本验证\n[5] 兼容4399 lunch 以及自定义目录！"

#Apps
#Tady 
def get_personality():
    today = datetime.date.today()
    random.seed(today.year + today.month + today.day)
    score = random.randint(0, 100)
    
    if score <= 20:
        return f"今天的人品评分是 {score}，非常糟糕，请小心行事！"
    elif score <= 40:
        return f"今天的人品评分是 {score}，你的运气比较差，要多加小心！"
    elif score <= 60:
        return f"今天的人品评分是 {score}，还算平均，不过要抓住机会哦！"
    elif score <= 80:
        return f"今天的人品评分是 {score}，运气不错，有机会会有好事发生！"
    else:
        return f"今天的人品评分是 {score}，非常好，好运连连！"

#welcome message
def get_welcome_message():
    current_hour = datetime.datetime.now().hour

    if current_hour < 6:
        return "夜深了，早点睡觉吧~"
    elif current_hour < 12:
        return "早上好！祝您有个美好的一天~"
    elif current_hour < 18:
        return "下午好！愿您度过愉快的时光~"
    else:
        return "晚上好！祝您度过愉快的夜晚~"
    


def desktop_path():
    key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
    path = winreg.QueryValueEx(key, "Desktop")[0]
    return path
desktop_path1 = desktop_path()
payload = {"os":"10.0","version":100000000,"entity_id":1}
header = {"content-type":"application/json"}
# 字典转换为json串
data = json.dumps(payload)
url = 'https://x19apigatewayobt.nie.netease.com/cpp-game-client-info'
response = requests.post(url,data=data,headers=header)
res=json.loads(response.text)
res1=res['entity']

def MC():
    print("--------基岩版下载器------")
    op("正在下载...","2")
    pathx=os.path.dirname(os.path.abspath(__file__))
    os.system(f"{pathx}\\wget.exe -c -O {desktop_path1}\\Minecraft.7z {res1['url']}")
    op("下载完成,正在执行解压操作...","2")
    os.system(f"{pathx}\\7z.exe x {desktop_path1}\\Minecraft.7z -o{desktop_path1}\\")
    op("解压完成,正在删除下载好的文件","2")
    os.system(f"del /f /s /q {desktop_path1}\\Minecraft.7z")
    op("开始执行移动操作","2")
    move_file(f"{desktop_path1}\\windowsmc",f"{windowsmc_path1}\\")
    op("完成,正在下载.checkInfo文件(网易基岩版验证文件)","2")
    os.system(f"{pathx}\\wget.exe -c -O {desktop_path1}\\.checkInfo https://gitee.com/dai-junhao-123/Minecraft-windows-for-Netease-download/raw/main/.checkInfo")
    op("完成,正在移动.checkInfo文件","2")
    os.system(f"move {desktop_path1}\\.checkInfo {windowsmc_path1}\\windowsmc\\")
    op("完成,按下Enter返回主菜单","2")
    input()
    menu()

def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False
    
def delete_directory(path):
    shutil.rmtree(path)

def delete(path_to_delete):
    delete_thread = threading.Thread(target=delete_directory, args=(path_to_delete,))
    delete_thread.start()
    delete_thread.join()

def delete_folder_content(folder_path):
    for file_name in os.listdir(folder_path):
        file_path = os.path.join(folder_path, file_name)
        if os.path.isfile(file_path):
            os.remove(file_path)
        elif os.path.isdir(file_path):
            with concurrent.futures.ThreadPoolExecutor() as executor:
                executor.submit(delete_folder_content, file_path)
            os.rmdir(file_path)

def move_file(source, destination):
    def move():
        shutil.move(source, destination)

    thread = threading.Thread(target=move)
    thread.start()


class colors:
    HEADER = ''
    BLUE = ''
    GREEN = ''
    WARNING = '' 
    FAIL = ''
    ENDC = ''
    BOLD = ''
    UNDERLINE = ''

#class colors:
#    HEADER = '033[95m'  # 紫色
#    BLUE = '033[94m'  # 蓝色
#    GREEN = '033[92m'  # 绿色
#    WARNING = '033[93m'  # 黄色
#    FAIL = '033[91m'  # 红色
#    ENDC = '033[0m'  # 终端默认颜色
#    BOLD = '033[1m'  # 加粗
#    UNDERLINE = '033[4m'  # 下划线

def clear_terminal():
    os.system('clear')  # for macOS and Linux
    os.system('cls') 

def set_terminal_title(title):
    ctypes.windll.kernel32.SetConsoleTitleW(title)

def op(out,put):
    now = datetime.datetime.now()
    current_time = now.strftime("%H:%M:%S")
    if put == "1":
        print(f"[Information：{current_time}] {out}" + colors.ENDC)
    elif put == "2":
        print(colors.GREEN + f"[Success：{current_time}] " + colors.ENDC + str(out))
    elif put == "3":
        print(colors.FAIL + f"[Error：{current_time}] " + colors.ENDC + str(out))
    elif put == "4":
        print(colors.WARNING + f"[WARNING：{current_time}] " + colors.ENDC + str(out))

def copy_and_replace(source_folder, destination_folder):
    if not os.path.exists(destination_folder):
        os.makedirs(destination_folder)

    def copy_files(src, dst):
        for item in os.listdir(src):
            s = os.path.join(src, item)
            d = os.path.join(dst, item)
            if os.path.isdir(s):
                if not os.path.exists(d):
                    os.makedirs(d)
                with concurrent.futures.ThreadPoolExecutor() as executor:
                    executor.submit(copy_files, s, d)  # 在创建新的线程池中执行复制文件操作
            else:
                shutil.copy2(s, d)

    with concurrent.futures.ThreadPoolExecutor() as executor:
        executor.submit(copy_files, source_folder, destination_folder)

    executor.shutdown()  # 清理资源

def addsmenu():
        clear_terminal()
        print (colors.ENDC + colors.BOLD + f"----------------" + colors.BLUE + f"附加包选项" + colors.ENDC + colors.BOLD + f"---------------------")
        print()
        print (colors.WARNING + f"[1]" + colors.ENDC + f" 安装防砍")
        print (colors.WARNING + f"[2]" + colors.ENDC + f" 安装动态天空（需光影）")
        print (colors.WARNING + f"[3]" + colors.ENDC + f" 删除材质包(只有方块和items)")
        print (colors.WARNING + f"[4]" + colors.ENDC + f" 删除光影")
        print (colors.WARNING + f"[5]" + colors.ENDC + f" 安装区块显示和刷怪区域显示")
        print (colors.WARNING + f"[6]" + colors.ENDC + f" 安装RGB方块选择【自带白色选择】")
        print (colors.WARNING + f"[7]" + colors.ENDC + f" 安装解压音效包【默认自带一个音效包】")
        print (colors.WARNING + f"[8]" + colors.ENDC + f" 安装几何字体包（全覆盖）")
        print (colors.WARNING + f"[9]" + colors.ENDC + f" 安装PangMenZhengDaoXiXianTi字体（全覆盖）")
        print (colors.WARNING + f"[10]" + colors.ENDC + f" 安装全新的VAPE风格的血量显示 [自己画的]")
        print (colors.WARNING + f"[11]" + colors.ENDC + f" 安装解压音效包（2) *来自绿菜汤")
        print (colors.WARNING + f"[12]" + colors.ENDC + f" 返回主菜单")
        print()
        key=input(colors.BLUE + f"[!]" + colors.ENDC + f" 请输入序号: ")
        ret = os.path.dirname(os.path.abspath(__file__))
        if key == "1":
            clear_terminal()
            
            op("开始安装...","2")
            copy_and_replace(f"{ret}\\resource\\fk",str(rep))
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "2":
            clear_terminal()
            op("开始安装...","2")
            if os.path.exists(f"{rep}\\textures\\environment\\overworld_cubemap"):
                shutil.rmtree(f"{rep}\\textures\\environment\\overworld_cubemap")
                op("安装完成！","2")
                op("按任回车返回菜单。","4")
            else:
                op("操作目录不存在，可能您已执行过次操作！","3")
                op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "3":
            clear_terminal()
            op("开始删除...","2")
            if os.path.exists(f"{rep}\\textures\\blocks") and os.path.exists(f"{rep}\\textures\\items"):
                shutil.rmtree(f"{rep}\\textures\\blocks")
                shutil.rmtree(f"{rep}\\textures\\items")
                op("操作完成！","2")
                op("按任回车返回菜单。","4")
            else:
                op("操作目录不存在，可能您已执行过次操作！","3")
                op("按任回车返回菜单。","4")
            input()
            addsmenu()

        elif key == "4":
            clear_terminal()
            op("开始删除...","2")
            if os.path.exists(f"{rep}\\materials") and os.path.exists(f"{rep}\\shaders"):
                shutil.rmtree(f"{rep}\\shaders")
                shutil.rmtree(f"{rep}\\materials")
                os.mkdir(f"{rep}\\shaders")
                os.mkdir(f"{rep}\\materials")
                copy_and_replace(f"{ret}\\resource\\no",f"{rep}")

                op("操作完成！","2")
                op("按任回车返回菜单。","4")
            else:
                op("操作目录不存在，可能您已执行过次操作！","3")
                op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "5":
            clear_terminal()
            op("开始安装...","2")
            copy_and_replace(f"{ret}\\resource\\qk",str(rep))
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "6":
            clear_terminal()
            op("开始安装...","2")
            copy_and_replace(f"{ret}\\resource\\RGB",str(rep))
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "7":
            clear_terminal()
            op("开始安装...","2")
            if os.path.exists(f"{rep}\\sounds"):
                shutil.rmtree(f"{rep}\\sounds")
                os.mkdir(f"{rep}\\sounds")
                copy_and_replace(f"{ret}\\resource\\yinxiao",str(rep))
                op("安装完成！","2")
                op("按任回车返回菜单。","4")
            else:
                op("操作目录不存在","3")
                op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "8":
            clear_terminal()
            op("开始安装...","2")
            copy_and_replace(f"{ret}\\resource\\J",str(rep))
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "9":
            clear_terminal()
            op("开始安装...","2")
            copy_and_replace(f"{ret}\\resource\\L",str(rep))
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "10":
            clear_terminal()
            op("开始安装...","2")
            shutil.copy(f"{ret}\\resource\\VAPE\\lonel_wjxx_bg.png",f"{rep}\\textures\\entity\\lonel_wjxx")
            op("安装完成！","2")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "11":
            clear_terminal()
            op("开始安装...","2")
            if os.path.exists(f"{rep}\\sounds"):
                shutil.rmtree(f"{rep}\\sounds")
                os.mkdir(f"{rep}\\sounds")
                copy_and_replace(f"{ret}\\resource\\Lvcai",str(rep))
                op("安装完成！","2")
                op("按任回车返回菜单。","4")
            else:
                op("操作目录不存在","3")
                op("按任回车返回菜单。","4")
            input()
            addsmenu()
        elif key == "12":
            menu()
        else:
            op("未知的编号","3")
            op("按任回车返回菜单。","4")
            input()
            addsmenu()
            


def copy():
    clear_terminal()
    print (colors.ENDC + colors.BOLD + f"----------------" + colors.BLUE + f"备份客户端" + colors.ENDC + colors.BOLD + f"---------------------")
    print()
    print (colors.WARNING + f"[1]" + colors.ENDC + f" 备份客户端")
    print (colors.WARNING + f"[2]" + colors.ENDC + f" 恢复客户端")
    print (colors.WARNING + f"[3]" + colors.ENDC + f" 设置备份目录")
    print (colors.WARNING + f"[4]" + colors.ENDC + f" 返回上级")
    print()
    ret = os.path.dirname(os.path.abspath(__file__))
    key=input(colors.BLUE + f"[!]" + colors.ENDC + f" 请输入序号: ")

    if key == "1":
        clear_terminal()
        if os.path.isfile(f"{ret}\\configs\\content.txt"):
            file_path = f"{ret}\\configs\\content.txt"
            file = open(file_path, "r")
            content = file.read()
            file.close()
            op("开始删除备份文件夹...","2")
            if os.path.exists(f"{content}\\windowsmc"):
                delete_folder_content(f"{content}\\windowsmc")
            op("开始备份...","2")
            copy_and_replace(f"{re}",str(content))
            op("备份完成！","2")
            op("按任回车返回菜单。","4")
            input()
            copy()
        else:
            op("未设置备份目录！按任意键返回菜单","3")
            input()
            copy()

    elif key == "2":
        clear_terminal()
        if os.path.isfile(f"{ret}\\configs\\content.txt"):
            op("开始删除...","2")
            delete(f"{re}")
            file_path = f"{ret}\\configs\\content.txt"
            file = open(file_path, "r")
            content = file.read()
            file.close()
            op("开始恢复...","2")
            copy_and_replace(str(content),f"{re}")
            op("恢复完成！","2")
            op("按任回车返回菜单。","4")
            input()
            copy()
        else:
            op("未设置备份目录！按任意键返回菜单","3")
            input()
            copy()

    elif key == "3":

        clear_terminal()
        k = input(colors.BLUE + "[!]" + colors.ENDC + " 请输入备份路径: ")
        if os.path.exists(k):
            op("操作完成","2")
        else:
            clear_terminal()
            op("无效的路径，按任意键返回菜单","3")
            input()
            copy()

        file_path = f"{ret}\\configs\\content.txt"
        file = open(file_path, "w")
        file.write(f"{k}")
        file.close()

        file = open(file_path, "r")
        content = file.read()
        file.close()

        op("创建完成！", "2")
        op("按任意键回车返回菜单。", "4")
        input()
        copy()
    elif key == "4":
        menu()
    else:
        op("未知的编号","3")
        op("按任回车返回菜单。","4")
        input()
        copy()



def menu():
    set_terminal_title(f"Hypixice One-click replacement [{V}]")
    clear_terminal()
    print(colors.BLUE + f"操作目录："+ colors.ENDC + str(rep) + colors.ENDC)
    print(colors.BLUE + f"启动器类型："+ colors.ENDC + str(play) + colors.ENDC)
    print()
    print("  " + get_welcome_message())
    print()
    print (colors.ENDC + colors.BOLD + f"----------------" + colors.BLUE + f"Hypixice One Click Replacement [Pro {V}]" + colors.ENDC + colors.BOLD + f"---------------------")
    print()
    print (colors.WARNING + f"[1]" + colors.ENDC + f" 安装端")
    print (colors.WARNING + f"[2]" + colors.ENDC + f" 安装附加包")
    print (colors.WARNING + f"[3]" + colors.ENDC + f" 备份目前安装的端/安装备份端")
    print (colors.WARNING + f"[4]" + colors.ENDC + f" 重新安装端 *使用直连下载 [2023.12.16_更新]")
    print (colors.WARNING + f"[5]" + colors.ENDC + f" 安装java材质包 [ZIP格式] [Alpha] [自动转换为基岩材质包并替换，UI不支持，只支持items，blocks，sky[非动态]。] [只支持Java1.18.0已下?]")
    print (colors.WARNING + f"[6]" + colors.ENDC + f" 查看更新记录")
    print (colors.WARNING + f"[7]" + colors.ENDC + f" 今日人品")
    print (colors.WARNING + f"[8]" + colors.ENDC + f" 退出")
    print()
    print ("帮助：在使用选项5时建议先在附加包中选择删除材质再安装！")
    print ()
    ##rept##
   
    key=input(colors.BLUE + f"[!]" + colors.ENDC + f" 请输入序号: ")
    if key == "1":
        if os.path.exists(f"{re}\windowsmc"):
            pass
        else:
            op ("未找到 windowsmc，可能已被删除。","3")
            input()
            menu()
        clear_terminal()
        op("开始替换...","2")
        ret = os.path.dirname(os.path.abspath(__file__))
        copy_and_replace(f"{ret}\\resource\\vanilla_netease",str(rep))
        if os.path.exists(f"{rep}\\contents.json"):
            try:
                os.remove(f"{rep}\\contents.json")
                op("删除字典完成！","2")
            except OSError as e:
                op(f"删除字典时出错：{e}","3")
        else:
            op("字典不存在，可能您已执行过次操作！","3")
        op("替换完成！","2")
        op("按任回车返回菜单。","4")
        input()
        menu()
    elif key == "2":
        addsmenu()

    elif key == "3":
        copy()
    
    elif key == "4":
        clear_terminal()
        if os.path.exists(f"{re}\\windowsmc"):
            op("删除文件...","2")
            delete(f"{re}\\windowsmc")

        MC()

    elif key == "5":
        clear_terminal()
        javapack()

    elif key == "6":
        clear_terminal()
        print(up)
        print("按任意键返回")
        input()
        menu()

    elif key == "7":
        clear_terminal()
        print("-------今日人品------")
        print(get_personality())
        print("按回车返回")
        input()
        menu()

    elif key == "8":
        exit()
    else:
        op("未知的编号","3")
        op("按任回车返回菜单。","4")
        input()
        menu()
    pass

#zip runing
def rename_first_zip_file(folder_path):
    for filename in os.listdir(folder_path):
        if filename.endswith('.zip'):
            new_filename = 'pack.zip'
            os.rename(os.path.join(folder_path, filename), os.path.join(folder_path, new_filename))
            return
        
def delete_files_except_textures(directory):
    for root, dirs, files in os.walk(directory):
        for file in files:
            file_path = os.path.join(root, file)
            if not file_path.startswith(os.path.join(directory, 'textures')):
                os.remove(file_path)
        for dir in dirs:
            if not os.path.join(root, dir).startswith(os.path.join(directory, 'textures')):
                shutil.rmtree(os.path.join(root, dir))

#java pack
def javapack():
    clear_terminal()
    print("------Java材质包转NetEasy基岩材质包 [Alpha] ------")
    if os.path.exists(f"{ret}\\javapack"):
        op("正在删除上次的残留文件","2")
        delete(f"{ret}\javapack")
        os.makedirs(f"{ret}\\javapack")
        os.makedirs(f"{ret}\\javapack\\pack")
        op("操作完成！","2")
    else:
        os.makedirs(f"{ret}\\javapack\\pack")
        os.makedirs(f"{ret}\\javapack")
        pass
    print("请将文件放入打开的文件夹中,完成请按回车。")
    os.startfile(f"{ret}\javapack")
    input()
    files = os.listdir(f"{ret}\javapack")
    file_count = len(files)
    if file_count == 2 :
        rename_first_zip_file(f"{ret}\javapack")
        op("正在解压材质包..","2")  
        os.system(f"{ret}\\7z.exe x {ret}\\javapack\\pack.zip -o{ret}\\javapack\\pack")
        op("解压完成！","2")
        op("开始分析文件！","2")
        if os.path.exists(f"{ret}\\javapack\\pack\\assets\\minecraft\\textures"):
            op("文件格式正确！","2")
            delete_files_except_textures(f"{ret}\\javapack\\pack\\assets\\minecraft")
            time.sleep(5)
            op("开始移动文件..","2")
            copy_and_replace(f"{ret}\\javapack\\pack\\assets\\minecraft",f"{rep}")  
            op("完成！","2")
            op("按回车返回菜单...","2")
            input()
            menu()
        else:
            print("Error: 错误的文件格式")
            op("按回车返回菜单...","2")
            input()
            menu()
    else:
        print(f"文件数大于2，目前只支持1个资源包！  {file_count}")
        op("按回车返回菜单...","2")
        input()
        menu()
#start

if is_admin():
    pass
else:
    op("请使用管理员权限运行！按回车退出...","3")
    input()
    exit()

ret = os.path.dirname(os.path.abspath(__file__))
#click
if os.path.exists(f"{ret}\\resource"):
    if os.path.isfile(f"{ret}\\resource\\V.txt"):
        file_path = f"{ret}\\resource\\V.txt"
        file = open(file_path, "r")
        Vs = file.read()
        file.close()
        if Vs==V:
            uptis="False"
        else:
            uptis="True"
            file_path = f"{ret}\\resource\\V.txt"
            file = open(file_path, "w")
            file.write(f"{V}")
            file.close()
            file = open(file_path, "r")
            content = file.read()
            file.close()
            
    else:
        uptis="True"
        file_path = f"{ret}\\resource\\V.txt"
        file = open(file_path, "w")
        file.write(f"{V}")
        file.close()
        file = open(file_path, "r")
        content = file.read()
        file.close()
else:
    uptis="True"

#echo
if uptis=="True":
    print(f"已更新到：{V} 版本！")
    print(f"{up}")
    print("按回车继续")
    input()
    op("开始删除旧版本文件...","2")
    if os.path.exists(f"{ret}\\resource"):
        delete(f"{ret}\\resource")
    op("完成！","2")

subprocess.run(['taskkill', '/F', '/IM', 'Minecraft.Windows.exe'])
set_terminal_title(f"Hypixice One-click replacement [{V}]")
clear_terminal()
print (colors.BLUE + f"")
print (colors.BLUE + f"MADE By: Hypixice")
print (colors.ENDC)
print (colors.WARNING + f"端版本：3.2.3")
print (colors.WARNING + f"一键换端版本：{V}")
print (colors.WARNING + f"更新日期：2023/12/20")
print (colors.WARNING + f"交流群：613015467")
print (colors.WARNING + f"作者：Hypixice")
print()
print ("--------------注意--------------\n运行时必须关闭网易基岩版进程否则会导致文件占用的换端失败！")
print ()
print (colors.GREEN + f">>>按任回车继续<<<")
input()
op("正在删除运行文件。","2")

clear_terminal()
op("正在执行解压运行文件","2")
if os.path.exists(f"{ret}\\resource"):
    pass
else:
    os.system(f"{ret}\\7z.exe x {ret}\\resource.7z -o{ret}\\")
    uptis="False"
    file_path = f"{ret}\\resource\\V.txt"
    file = open(file_path, "w")
    file.write(f"{V}")
    file.close()
    file = open(file_path, "r")
    content = file.read()
    file.close()





#regseting
#regseting
registry_path = r"\Software\Netease\MCLauncher"
reg_path = r"Software\Netease\MCLauncher"
reg_key = "MinecraftBENeteasePath"

try:
    reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
    key = winreg.OpenKey(reg, reg_path)
    value = winreg.QueryValueEx(key, reg_key)[0]
    rep_neteasy = value
    winreg.CloseKey(key)
    play = "1"
except FileNotFoundError:
    print(colors.FAIL + "[Neteasy-reg-git] 注册表路径或键名称无效" + colors.ENDC)
    play = "0"
except PermissionError:
    print(colors.FAIL + "[Neteasy-reg-git] 没有足够权限访问注册表" + colors.ENDC)
    play = "0"
except Exception as e:
    print(colors.FAIL + f"[Neteasy-reg-git] 发生了一个错误：{str(e)}" + colors.ENDC)
    play = "0"


if play=="0":
    print("[error] 无法获取4399与Neteasy的客户端安装路径！ 是否手动选择? [Y/N]")
    key=input("")
    if key=="Y":
        re=input("请输入您的安装路径如：C:\MCLDownload\MinecraftBENetease。 请输入: ")
        if os.path.exists(re):
            op("操作完成","2")
            play="Windowsmc Lunch"
        else:
            clear_terminal()
            op("无效的路径，按任意键退出","3")
            exit()
elif play=="1":
    print("Neteasy!")
    play="Neteasy Lunch"
    re=rep_neteasy
    pass
elif play=="2":
    print("检测到有多个启动器安装路径！请选择您要选中的路径！")
    
    print(f"[2] [已识别] Neteasy启动器: {rep_neteasy}")
    key=input("")
    if key=="1":
        print("已选中4399！")
        play="4399 Lunch"

    elif key=="2":
        print("已选择neteasy！")
        play="Neteasy Lunch"
        re=rep_neteasy
    else:
        print("未知的编号，按任意键退出。")
        exit()

    
else:
    pass
    exit()

rep=str(re)+r"\windowsmc\data\resource_packs\vanilla_netease"
windowsmc_path1=re

menu()